package la.iok.hzsvn.lewin.movie.core.shopmovie.param;

import la.iok.hzsvn.lewin.movie.core.model.CouponBase;

import java.util.Objects;

/**
 * 优惠卷定义的参数
 */
public class CouponDefinitionParam extends CouponBase {

    /**
     * 优惠券适用的剧本类别.如果是-1，则不限制适用的剧本类别
     */
    private Long movieLevelId;
    /**
     * 最大抵扣金额。当是折扣券的时候,根据使用的实际金额，以百分比进行抵扣，如果计算的抵扣金额大于最大抵扣金额,则只能以最大抵扣金额进行抵扣
     */
    private Integer maxAmount;

    public Long getMovieLevelId() {
        return movieLevelId;
    }

    public void setMovieLevelId(Long movieLevelId) {
        this.movieLevelId = movieLevelId;
    }

    public Integer getMaxAmount() {
        return maxAmount;
    }

    public void setMaxAmount(Integer maxAmount) {
        this.maxAmount = maxAmount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof CouponDefinitionParam)) return false;
        if (!super.equals(o)) return false;
        CouponDefinitionParam param = (CouponDefinitionParam) o;
        return Objects.equals(movieLevelId, param.movieLevelId) && Objects.equals(maxAmount, param.maxAmount);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), movieLevelId, maxAmount);
    }

    @Override
    public String toString() {
        return "CouponDefinitionParam{" +
                "name='" + getName() + '\'' +
                ", type=" + getType() +
                ", amount=" + getAmount() +
                "movieLevelId=" + movieLevelId +
                ", maxAmount=" + maxAmount +
                '}';
    }
}
